/***************************************
	文件：BattleSceneCtrl.cs
	作者：林文豪
	日期：2021-05-18
	功能：1、战斗场景控制脚本，生成敌人
****************************************/
using System;
using MyGame.AI.GOAP;
using MyGame.Character;
using MyGame.Global;
using MyGame.Test;
using UnityEngine;

namespace MyGame.GameCtrl {
	public class BattleSceneCtrl : MonoBehaviour {
		public static BattleSceneCtrl Instance;

		public BattleSceneUICtrl UICtrl;
		public Action<Enemy>     OnEnemyCreatedAfter;
		
		private void Awake() {
			Instance = this;
		}

		private void Start() {
			UICtrl.Init();
			CreateEnemy(EnemyType.Enemy1);
			CreateEnemy(EnemyType.Enemy2);
			CreateEnemy(EnemyType.Enemy2);
			CreateEnemy(EnemyType.Enemy3);
			CreateEnemy(EnemyType.Enemy3);
			CreateEnemy(EnemyType.Enemy3);
		}

		private void CreateEnemy(EnemyType enemyType) {
			Enemy enemy = GoapFactory.Instance.GenerateEnemy(enemyType);
			OnEnemyCreatedAfter?.Invoke(enemy);
		}
	}
}
